package com.nineclock.system.controller;

import com.nineclock.common.entity.Result;
import com.nineclock.system.dto.SysCompanyUserDTO;
import com.nineclock.system.service.SysCompanyUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/")
public class SysCompanyUserController {
    @Autowired
    SysCompanyUserService companyUserService;
    //根据企业ID查询企业的主管理员信息
    @GetMapping("/queryAdminByCompanyId")
    public Result<SysCompanyUserDTO> queryAdminByCompanyId(Long companyId){
        SysCompanyUserDTO companyUserDTO = companyUserService.queryAdminByCompanyId(companyId);
        return Result.success(companyUserDTO);
    }

    @GetMapping("/queryAllUserByCompanyId")
    public Result<List<SysCompanyUserDTO>> queryAllUserByCompanyId(Long companyId){
        List<SysCompanyUserDTO> companyUserDTOList = companyUserService.queryAllUserByCompanyId(companyId);
        return Result.success(companyUserDTOList);
    }
}
